import axios from 'axios';
import NProgress from 'nprogress'

// const apiClient = axios.create({
//     baseURL: 'http://localhost:3001',
//     withCredentials: true,
//     headers: {
//         Accept: 'application/json',
//         'Content-Type': 'application/json'
//     }
// })

axios.defaults.baseURL = 'http://localhost:3001'
axios.defaults.withCredentials = true
axios.defaults.headers = {
    Accept: 'application/json',
    'Content-Type': 'application/json'
}
axios.defaults.timeout = 5000


axios.interceptors.request.use(config => {
    console.log('request start')
    NProgress.start()
    return config
})
axios.interceptors.response.use(response => {
    setTimeout(() => {
        NProgress.done()
        console.log('response done');
    }, 1000);
    return response
})
